$(function(){
		
	var watch = $("#watch");
	
	var hmsw = $("#watch > div.digital-wrap li");
	hmsw = watch.children("div.digital-wrap").find("li");
	console.info(hmsw);
	
	var ymd = $("#watch > div.digital-wrap-year > ul > li");
	console.info(ymd);
	
	var hms = $("#watch > div:gt(-4)");
	console.info(hms);
	
	var os = hmsw.add(ymd).add(hms);
	console.info(os);
	
	
	var setText = function(obj,txt,len){
		txt = ("0000"+txt).substr(-len);
		if(obj.text()!=txt){
			obj.text(txt);
			obj.addClass("watchBounceInDown");
			window.setTimeout(function(){
				obj.removeClass("watchBounceInDown");
			},500);
		}
	}
	
	


	var timePlayer = function(){
		var d = new Date();
		hms.eq(2).css("transform","rotate("+(6*d.getSeconds()+0.006*d.getMilliseconds())+"deg)");
		hms.eq(1).css("transform","rotate("+(6*d.getMinutes()+0.1*d.getSeconds())+"deg)");
		hms.eq(0).css("transform","rotate("+(30*d.getHours()+0.5*d.getMinutes())+"deg)");
		
		setText(ymd.eq(0),d.getFullYear(),4);
		setText(ymd.eq(1),d.getMonth()+1,2);
		setText(ymd.eq(2),d.getDate(),2);
		
		setText(hmsw.eq(0),d.getHours(),2);
		setText(hmsw.eq(1),d.getMinutes(),2);
		setText(hmsw.eq(2),d.getSeconds(),2);
		
		
	}
	
	window.setInterval(timePlayer,80);
	timePlayer();
	
});
